/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.compomics.dataprovider.playground;

import com.compomics.dataprovider.control.logic.fasta.FastaSourceConverter;
import com.compomics.dataprovider.model.fasta.FastaStream;
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.IOException;

/**
 *
 * @author Kenneth
 */
public class lncrna {

    public static void main(String args[]) throws IOException {
        File spFile = new File("C:\\Users\\Kenneth\\Desktop\\lncipedia_3_0_translated_non_redundant\\reading_frames\\HUMAN_UNIPROT_REVIEWED_14_10_14.fasta");
        File virusFile = new File("C:\\Users\\Kenneth\\Desktop\\lncipedia_3_0_translated_non_redundant\\reading_frames\\VIRAL_HUMAN_HOST_UNIPROT_REVIEWED_20_10_14.fasta");
        File[] toMerge = new File("C:\\Users\\Kenneth\\Desktop\\lncipedia_3_0_translated_non_redundant\\reading_frames\\Backup").listFiles();
        System.out.println("Starting to merge...");
        for (File aFile : toMerge) {
            System.out.print(aFile);
            File output = new File("C:\\Users\\Kenneth\\Desktop\\lncipedia_3_0_translated_non_redundant\\reading_frames\\Analysis\\Result\\SP+VIR+CRAP_" + aFile.getName());
            ByteArrayInputStream convertToStream = FastaSourceConverter.convertToStream(aFile);
            FastaStream stream = new FastaStream(convertToStream)
                    .concatenate(spFile)
                    .concatenate(virusFile)
                    .appendCRAP()
                    .addDecoys()
                    .removeDuplicateAccessions()
                    .removeDuplicateSequences();
            stream.save(output, true);
            System.out.println(" - Done !");
        }
    }
}
